//
// Created by Administrator on 2020/10/29.
//

#ifndef CSP_INCLUDE_UTILS_POLLER_H_
#define CSP_INCLUDE_UTILS_POLLER_H_

#include "commDef.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct Poller S_Poller;

typedef void (*PollEventHandle)(int32_t event, int fd, void *data);

S_Poller *POLLER_Create(uint32_t fdNumMax);
void POLLER_Destroy(S_Poller *self);
int32_t POLLER_Add(S_Poller *self, int fd, PollEventHandle inHandle,
    PollEventHandle outHandle, PollEventHandle otherHandle, void *data);
int32_t POLLER_Remove(S_Poller *self, int fd);
int32_t POLLER_Poll(S_Poller *self, int32_t timeoutMs);

#ifdef __cplusplus
}
#endif

#endif //CSP_INCLUDE_UTILS_POLLER_H_
